package gui.swings;

import java.awt.BorderLayout;
import java.awt.Color;
import java.awt.GridLayout;

import javax.swing.JLabel;
import javax.swing.JPanel;
import javax.swing.border.BevelBorder;
import javax.swing.border.Border;
import javax.swing.border.CompoundBorder;
import javax.swing.border.EtchedBorder;
import javax.swing.border.LineBorder;
import javax.swing.border.MatteBorder;
import javax.swing.border.SoftBevelBorder;
import javax.swing.border.TitledBorder;

public class SwingBorder extends JPanel {
	static JPanel showBorder(Border b) {
		JPanel jp = new JPanel();
		jp.setLayout(new BorderLayout());
		String nm = b.getClass().toString();
		nm = nm.substring(nm.lastIndexOf(".") + 1);
		jp.add(new JLabel(nm, JLabel.CENTER), BorderLayout.CENTER);
		jp.setBorder(b);
		return jp;
	}

	SwingBorder() {
		this.setLayout(new GridLayout(2, 4));
		this.add(showBorder(new TitledBorder("Title")));
		this.add(showBorder(new EtchedBorder()));
		this.add(showBorder(new LineBorder(Color.blue)));
		this.add(showBorder(new MatteBorder(5,5,30,30,Color.green)));
		this.add(showBorder(new BevelBorder(BevelBorder.RAISED)));
		this.add(showBorder(new SoftBevelBorder(SoftBevelBorder.LOWERED)));
		this.add(showBorder(new CompoundBorder(new EtchedBorder(),new LineBorder(Color.red))));
		
	}
	
	public static void main(String[]args){
		SwingShow.inFrame(new SwingBorder(), 300, 300);
	}

}
